﻿/* 绝版点卷商店 */

var status = -1;
var itemList = Array(
Array(1050291, 10000),
Array(1051357, 10000),
Array(1050310, 10000),
Array(1051382, 10000),
Array(1052634, 15000),
Array(5010110, 20000),
Array(1004193, 20000),
Array(1112176, 20000),
Array(1112288, 20000),
Array(1102706, 20000),
Array(1112947, 20000),
Array(1112822, 20000),
Array(1003761, 30000),
Array(1082503, 30000),
Array(1072779, 30000),
Array(1702347, 20000),
Array(1702503, 20000),
Array(1050318, 20000),
Array(1051389, 20000),
Array(1702501, 20000),
Array(1102709, 20000),
Array(1102699, 20000),
Array(5010101, 20000),
Array(1003859, 20000),
Array(1102376, 20000),
Array(1702305, 20000),
Array(1102548, 20000),
Array(1072821, 20000),
Array(1102587, 20000),
Array(1102511, 20000),
Array(1052605, 20000),
Array(1004137, 20000),
Array(1003831, 20000),
Array(1062203, 20000),
Array(1042314, 20000),
Array(1102683, 20000),
Array(1062210, 20000),
Array(1042320, 20000),
Array(1072942, 20000),
Array(1102705, 20000),
Array(1041114, 20000),
Array(1042278, 20000),
Array(1003889, 20000),
Array(1061113, 20000),
Array(1003920, 20000),
Array(1082555, 20000),
Array(1003955, 20000),
Array(3000050, 20000),
Array(1102550, 20000),
Array(1062204, 20000),
Array(1072911, 20000),
Array(1052709, 20000),
Array(1052657, 20000),
Array(1004095, 20000),
Array(1082555, 20000),
Array(1072860, 20000),
Array(1051366, 20000),
Array(1702478, 20000),
Array(1702263, 20000),
Array(1102620, 20000),
Array(1004029, 20000),
Array(1702530, 20000),
Array(1702382, 20000),
Array(5010044, 20000),
Array(1003204, 20000),
Array(1004110, 20000),
Array(1702466, 20000),
Array(1001083, 20000),
Array(1702334, 20000),
Array(1102583, 20000),
Array(1702480, 20000),
Array(1052727, 25000),
Array(1072808, 25000),
Array(1102676, 25000),
Array(1001095, 25000),
Array(1050310, 25000),
Array(1702485, 25000),
Array(1004200, 25000),
Array(1072862, 20000),
Array(1102644, 20000),
Array(1042159, 20000),
Array(1112263, 30000),
Array(1113021, 30000),
Array(1112151, 30000),
Array(1062171, 30000),
Array(1042285, 30000),
Array(1003892, 30000),
Array(1042275, 30000),
Array(1052656, 30000),
Array(1004124, 30000),
Array(1003953, 30000),
Array(1072919, 30000),
Array(1051366, 30000),
Array(1004125, 30000),
Array(1112155, 30000),
Array(1112162, 30000),
Array(1003713, 30000),
Array(1052550, 30000),
Array(1112267, 30000),
Array(1004203, 30000),
Array(1042240, 30000),
Array(1062172, 30000),
Array(1004117, 30000),
Array(1702509, 30000),
Array(1042315, 30000),
Array(1050319, 30000),
Array(1042316, 30000),
Array(1051390, 30000),
Array(1071076, 30000),
Array(1001097, 30000),
Array(1000074, 30000),
Array(1004200, 30000),
Array(1001076, 30000),
Array(1070059, 30000),
Array(1051392, 30000),
Array(1050299, 30000),
Array(1071078, 30000),
Array(1112236, 30000),
Array(1702013, 30000),
Array(1112126, 30000),
Array(1052782, 30000),
Array(1072543, 30000),
Array(1102726, 30000),
Array(1004204, 30000),
Array(1004205, 30000),
Array(1052781, 30000),
Array(1003950, 30000),
Array(1042214, 30000),
Array(1102142, 30000),
Array(1004126, 20000),
Array(1042311, 20000),
Array(1702374, 20000),
Array(1002846, 20000),
Array(1004158, 20000),
Array(1004114, 20000),
Array(1102697, 20000),
Array(1112943, 20000),
Array(1002598, 20000),
Array(1102688, 20000),
Array(1004157, 30000),
Array(1004156, 30000),
Array(1702512, 20000),
Array(1032234, 20000),
Array(1702459, 20000),
Array(1042321, 20000),
Array(1002967, 20000),
Array(1702508, 20000),
Array(1702233, 20000),
Array(1004025, 20000),
Array(1012253, 20000),
Array(1004093, 20000),
Array(1042312, 20000),
Array(4000897, 20000),
Array(1042313, 20000),
Array(1702334, 20000),
Array(1022194, 20000),
Array(1022217, 20000),
Array(1102669, 20000),
Array(1050152, 10000), //水兵服(男)
Array(1051180, 10000), //水兵服(女)
Array(1042104, 10000), //小绿叶T恤
Array(1042105, 10000), //小红叶T恤
Array(1002845, 10000), //粉红兔耳帽
Array(1052224, 10000), //草莓baby装
Array(1702228, 10000), //可可香蕉
Array(1002721, 10000), //狸毛护耳
Array(1002568, 10000), //手工编织发夹
Array(1702155, 30000), //绚丽彩虹
Array(1042142, 30000), //彩虹条背心
Array(1062093, 30000), //嫩绿休闲短裤
Array(1112904, 30000), //彩虹星环绕戒指
Array(1041142, 20000), //巨星蛋糕吊带
Array(1061148, 20000), //巨星粉色短裙
Array(1702182, 20000), //洛丽波板糖
Array(1002888, 10000), //丝带发箍(红色)
Array(1002890, 10000), //丝带发箍(蓝色)
Array(1052200, 10000), //罗丽粉色娃娃套服
Array(1702208, 10000), //搞怪鳄鱼
Array(1002863, 20000), //小熊熊可爱帽
Array(1052061, 20000), //巴西足球服No.9
Array(1052059, 20000), //法国足球服No.14
Array(1003207, 20000), //胡萝卜兔爆炸头
Array(1702285, 20000), //蓝色蝴蝶结手提包
Array(1012131, 30000), //好白的牙
Array(1702302, 10000), //杯具
Array(1072337, 5000), //喜洋洋拖鞋
Array(1112238, 5000), //水墨花聊天戒指
Array(1112135, 5000), //水墨花名片戒指
Array(1051131, 5000), //圣诞女孩子服
Array(1112916, 30000), //寂寞单身戒指
Array(1012179, 20000), //鹿鼻子
Array(1051152, 10000), //玫瑰红晚宴裙
Array(1112118, 10000), //可乐名片戒指
Array(1112119, 10000), //可乐(Red) 名片戒指
Array(1112120, 10000), //可乐(White) 名片戒指
Array(1112228, 10000), //可乐聊天戒指
Array(1112229, 10000), //可乐(Red)聊天戒指
Array(1112230, 10000),  //可乐(White)聊天戒指
Array(1112103, 10000),
Array(1050210, 10000),
Array(1112141, 10000),
Array(1112252, 10000),
Array(1112253, 10000),
Array(1112142, 10000),
//
Array(1051280, 10000),
Array(1052426, 10000),
Array(1051278, 10000),
Array(1050229, 10000),
Array(1050227, 10000),
Array(1051235, 10000),
Array(1052201, 10000),
Array(1050232, 10000),
Array(1051282, 10000),
Array(1052425, 10000),
Array(1052412, 10000),
Array(1102503, 10000),
Array(1052455, 10000),
Array(1052503, 10000),
Array(1051261, 10000),
Array(1050230, 10000),
Array(1050231, 10000),
Array(1051149, 10000),
Array(1051192, 10000),
Array(1051255, 10000),
Array(1051256, 10000),
Array(1112422, 10000),
Array(1112424, 10000),
Array(1112930, 10000),
Array(1112136, 10000),
Array(1112920, 5000),
Array(1702367, 5000),
Array(1702341, 5000),
Array(1322102, 5000),
Array(1702366, 5000),
Array(1702352, 5000),
Array(1302037, 5000),
Array(1302061, 5000),
Array(1302063, 5000),
Array(1302080, 5000),
Array(1302084, 5000),
Array(1302085, 5000),
Array(1302087, 5000),
Array(1302169, 5000),
Array(1322051, 5000),
Array(1332032, 5000),
Array(1332053, 5000),
Array(1372017, 5000),
Array(1372031, 5000),
Array(1402037, 5000),
Array(1402049, 5000),
Array(1402063, 5000),
Array(1422011, 5000),
Array(1432039, 5000),
Array(1432046, 5000),
Array(1442026, 5000),
Array(1442065, 5000),
Array(1442088, 5000),
Array(1472063, 5000),
Array(1702342, 5000),
Array(1702337, 5000),
Array(1702335, 5000),
Array(1702330, 5000),
Array(1702346, 5000),
Array(1702341, 5000),
Array(1702340, 5000),
Array(1702324, 5000),
Array(1322102, 5000),
Array(1412056, 5000),
Array(1402110, 5000),
Array(1702310, 5000),
Array(1702329, 5000),
Array(1702316, 5000),
Array(1702309, 5000),
Array(1102380, 5000),
Array(1102385, 5000),
Array(1102386, 5000),
Array(1102238, 5000),
Array(1102241, 5000),
Array(1102248, 14000),
Array(1102245, 14000),
Array(1102265, 14000),
Array(1102285, 14000),
Array(1102286, 14000),
Array(1102287, 14000),
Array(1102270, 14000),
Array(1102273, 14000),
Array(1102288, 14000),
Array(1102253, 14000),
Array(1102298, 14000),
Array(1102299, 14000),
Array(1102297, 14000),
Array(1102310, 14000),
Array(1102319, 14000),
Array(1102272, 14000),
Array(1102323, 14000),
Array(1102324, 14000),
Array(1102349, 14000),
Array(1102325, 14000),
Array(1102326, 14000),
Array(1102338, 14000),
Array(1102350, 14000),
Array(1102374, 14000),
Array(1102353, 14000),
Array(1102357, 14000),
Array(1003214, 14000),
Array(1003141, 14000),
Array(1003269, 14000),
Array(1003268, 14000),
Array(1003492, 14000),
Array(1003493, 14000),
Array(1003494, 14000),
Array(1003495, 14000),
Array(1003496, 14000),
Array(1003519, 14000),
Array(1003520, 14000),
Array(1002726, 14000),
Array(1002524, 14000),
Array(1002714, 14000),
Array(1002841, 14000),
Array(1003220, 14000),
Array(1003219, 14000),
Array(1003170, 14000),
Array(1003226, 14000),
Array(1003227, 14000),
Array(1000050, 14000),
Array(1003232, 14000),
Array(1001064, 14000),
Array(1001075, 14000),
Array(1003252, 14000),
Array(1003249, 14000),
Array(1001036, 14000),
Array(1002425, 14000),
Array(1002677, 14000),
Array(1002702, 14000),
Array(1002707, 14000),
Array(1002728, 14000),
Array(1002743, 14000),
Array(1002749, 14000),
Array(1002758, 14000),
Array(1002788, 14000),
Array(1002812, 14000),
Array(1002851, 14000),
Array(1002858, 14000),
Array(1002867, 14000),
Array(1002939, 14000),
Array(1002971, 14000),
Array(1002972, 14000),
Array(1002980, 14000),
Array(1002997, 14000),
Array(1002998, 14000),
Array(1003091, 14000),
Array(1003114, 14000),
Array(1003075, 14000),
Array(1000043, 14000),
Array(1003149, 14000),
Array(1002988, 14000),
Array(1003154, 14000),
Array(1003159, 14000),
Array(1003169, 14000),
Array(1003193, 14000),
Array(1003194, 14000),
Array(1003195, 14000),
Array(1003196, 14000),
Array(1003271, 14000),
Array(1003360, 14000),
Array(1003359, 14000),
Array(1003417, 14000),
Array(1112204, 14000),
Array(1003581, 15000),
Array(1042263, 15000),
Array(1062173, 10000),
Array(1072820, 10000),
Array(1702422, 15000),
Array(1112101, 10000),
Array(1112937, 15000),
Array(1012134, 10000),
Array(1112907, 15000),
Array(1112928, 15000),
Array(1050119, 15000),
Array(1042198, 15000),
Array(1062072, 15000),
Array(1002566, 15000),
Array(1112145, 15000),
Array(1112257, 15000),
Array(1112146, 15000),
Array(1112258, 15000),
Array(1112254, 15000),
Array(1112143, 15000),
Array(1102453, 30000), 
Array(1102450, 30000), 
Array(1102451, 30000), 
Array(1102452, 30000), 
Array(1102511, 30000), 
Array(1102385, 30000), 
Array(1102386, 30000), 
Array(1102487, 30000), 
Array(1082549, 15000),
Array(1082548, 15000),
Array(1072843, 15000),
Array(1072832, 15000),
Array(1062174, 15000),
Array(1042204, 15000),
Array(1012208, 15000),
Array(1012165, 15000),
Array(1012412, 15000),
Array(1012413, 15000),
Array(1702442, 15000),
Array(1702422, 15000),
Array(1702446, 15000),
Array(1702460, 15000),
Array(1702408, 15000),
Array(1702415, 15000),
Array(1702403, 15000),
Array(1702402, 15000),
Array(1702375, 15000),
Array(1702348, 15000),
Array(1003965, 15000),
Array(1003964, 15000),
Array(1003920, 15000),
Array(1003921, 15000),
Array(1003918, 15000),
Array(1003861, 15000),
Array(1003865, 15000),
Array(1003919, 15000),
Array(1102593, 15000),
Array(1102564, 15000),
Array(1102615, 15000),
Array(1052661, 15000),
Array(1042277, 15000),
Array(1060181, 15000),
Array(1052593, 15000),
Array(1052536, 15000),
Array(1050312, 15000),
Array(1042236, 15000),
Array(1042240, 15000),
Array(1062157, 15000),
Array(1042265, 15000),
Array(1042241, 15000),
Array(1062156, 15000),
Array(1042238, 15000),
Array(1040192, 15000),
Array(1041194, 15000),
Array(1003505, 15000),
Array(1003504, 15000),
Array(1061207, 15000)
//
);
var selectedItem = -1;
var selectedCost = -1;

function start() {
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == 1) {
        status++;
    } else {
        if (status >= 0) {
            cm.dispose();
            return;
        }
        status--;
    }
    if (status == 0) {
        var selStr = "#fUI/UIWindow2.img/Quest/quest_info/summary_icon/summary#\r\n#fUI/UIWindow2.img/QuestAlarm/BtQ/normal/0#亲爱的#r#h ##k您好，请选择您希望购买的道具：";
        for (var i = 0; i < itemList.length; i++) {
            selStr += "\r\n#L" + i + "##i" + itemList[i][0] + ":# #b#t" + itemList[i][0] + "##k   #r" + itemList[i][1]  + "#k点卷#l";
        }
        cm.sendSimple(selStr);
    } else if (status == 1) {
        var item = itemList[selection];
        if (item != null) {
            selectedItem = item[0];
            selectedCost = item[1];
            cm.sendYesNo("您是否购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k 需要 #r" + selectedCost + "#k 点卷？");
        } else {
            cm.sendOk("出现错误...");
            cm.dispose();
        }
    } else if (status == 2) {
        if (selectedCost <= 0 || selectedItem <= 0) {
            cm.sendOk("购买道具出现错误...");
            cm.dispose();
            return;
        }
        if (cm.getPlayer().getCSPoints(1) >= selectedCost) {
            var gachaponItem = cm.gainGachaponItem(selectedItem, 1, "点卷商店", 3, true);
            if (gachaponItem != -1) {
                cm.gainNX( - selectedCost );
                cm.sendOk("恭喜您成功购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k。");
            } else {
                cm.sendOk("购买失败，请您确认在背包所有栏目窗口中是否有一格以上的空间。");
            }
        } else {
            cm.sendOk("您没有那么多点卷。\r\n\r\n购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k 需要 #r" + selectedCost + "#k 点卷。");
        }
        cm.dispose();
    }
}
